home *** CD-ROM | disk | FTP | other *** search
/ IRIS Performer 2.2 Friends Demo / SGI IRIS Performer 2.2 Friends Demo.iso / friends / devices / BGSystems / CerealBox / pattern.c < prev    next >
C/C++ Source or Header  |  1997-10-31  |  1KB  |  73 lines

  1. /*
  2.  * Copyright 1994   BG Systems, Inc.
  3.  * pattern.c
  4.  *
  5.  * Send a pattern to the dig outs...
  6.  *
  7.  * Author         Date       Comments
  8.  * John Green     15-Oct-94  Author
  9.  * John Green     01-Feb-95  Rev 3.0 release
  10.  */
  11.  
  12. static char SccsId[] = "@(#)pattern.c    1.2 01 Feb 1995";
  13.  
  14. #include <stdio.h>
  15.  
  16. #include "lv3.h"
  17.  
  18.  
  19. void pattern(long *count, bglv *bgp)
  20. {
  21.    long i;
  22.    static int direction = 1;
  23.  
  24.    i = *count;
  25.  
  26.    if ( i > 64 )
  27.    {
  28.       bgp->dout[0] = 0x0;
  29.       bgp->dout[1] = 0x0;
  30.       bgp->dout[2] = 0x0;
  31.       direction = -1;
  32.    }
  33.    else if ( i > 40 )
  34.    {
  35.       bgp->dout[0] |= 0x1 << i-41;
  36.       bgp->dout[1] |= 0x1 << (64-i-8);
  37.       bgp->dout[2] |= 0x1 << (64-i);
  38.    }
  39.    else if ( i > 16 )
  40.    {
  41.       bgp->dout[0] = 0x1 << i-17;
  42.       bgp->dout[1] = 0x1 << (40-i-8);
  43.       bgp->dout[2] = 0x1 << (40-i);
  44.    }
  45. /*
  46.  *  All 3 going clockwise, adding
  47.  */
  48.    else if ( i >= 8  )
  49.    {
  50.       bgp->dout[0] |= 0x1 << (i -8);
  51.       bgp->dout[1] |= 0x1 << (16 - i);
  52.       bgp->dout[2] |= 0x1 << (16 - i);
  53.    }
  54. /*
  55.  *  All 3 going clockwise
  56.  */
  57.    else if ( i >= 0)
  58.    {
  59.       bgp->dout[0] = 0x1 << i;
  60.       bgp->dout[1] = 0x1 << (8-i);
  61.       bgp->dout[2] = 0x1 << (8-i);
  62.    }
  63.    else if ( i < 0 )
  64.       direction = 1;
  65.  
  66.    if ( direction == 1 )
  67.       i++;
  68.    else if ( direction == -1 )
  69.       i--;
  70.  
  71.    *count = i;
  72. }
  73.